using Abp.Runtime.Security;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Primitives;
using Mt.Site.Application.Authorization.Accounts.Dto;
using Mt.Site.Core.Security;
using System;

namespace Mt.Site.Web.Areas.B.Models.Account
{
    public class ResetPasswordViewModel  : ResetPasswordInput
    {
        public int? TenantId { get; set; }

        public PasswordComplexitySetting PasswordComplexitySetting { get; set; }

        protected override void ResolveParameters()
        {
            base.ResolveParameters();

            if (!string.IsNullOrEmpty(c))
            {
                var parameters = SimpleStringCipher.Instance.Decrypt(c);
                var query = QueryHelpers.ParseQuery(parameters);

                if (query.TryGetValue("tenantId", out StringValues tenantId))
                {
                    TenantId = Convert.ToInt32(tenantId);
                }
            }
        }
    }
}